<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/style.css"/>
		<style type="text/css">
		html{height:100%} 
		body{height:100%;margin:0px;padding:0px;overflow: hidden;} 
		</style> 
	</head>
	<body class="login_body" style="background-image: url(images/login_back.jpg);background-size: cover; height: 100%;">
		<header class="mui-bar mui-bar-nav header">
			<h1 class="mui-title GTM">登录</h1>
		</header>
		<div id="log" style="text-align: center; margin-top: 30%;">
			<img src="./images/login_user.jpg" style="width: 100px; height: 100px; border-radius: 50%; border: 3px solid #accfab;">
		</div>
		<form style="margin-top: 20%;">
			<div style="text-align: center;">
				<input style="height: 40px; width: 70%; margin: 0 auto; background-color: #eaeaea; border-radius: 20px; border: 0;" type="text" placeholder="请输入账户名" id="account">
			</div>
			<div style="text-align: center; margin-top: 15px;">
				<input style="height: 40px; width: 70%; margin: 0 auto; background-color: #eaeaea; border-radius: 20px; border: 0;" type="password" class="mui-input-password" placeholder="请输入密码" id="password">
			</div>
			<div class="mui-button-row" style="margin-top: 40px; border: 0rem;">
				<!-- <button type="button" class="mui-btn mui-btn-primary" id="primary" onclick="login()" style="width:60%;">登录</button> -->
				<svg id="primary" onclick="login()" t="1617950218638" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2444" width="100" height="100">
					<path d="M509.62963 146.299259c-209.540741 0-380.017778 170.287407-380.017778 379.543704 0 209.256296 170.477037 379.543704 380.017778 379.543704 209.540741 0 380.017778-170.287407 380.017778-379.543704C889.647407 316.586667 719.17037 146.299259 509.62963 146.299259zM509.62963 867.555556c-188.397037 0-341.712593-153.220741-341.712593-341.712593 0-188.397037 153.315556-341.712593 341.712593-341.712593 188.397037 0 341.712593 153.315556 341.712593 341.712593C851.247407 714.24 698.026667 867.555556 509.62963 867.555556z" p-id="2445" fill="#515151"></path>
					<path d="M729.220741 518.637037 570.69037 360.011852c-3.887407-3.887407-12.325926-1.896296-18.773333 4.456296-6.447407 6.447407-8.438519 14.791111-4.456296 18.773333l125.060741 125.060741L305.398519 508.302222c-9.671111 0-17.540741 7.86963-17.540741 17.540741l0 0c0 9.671111 7.86963 17.540741 17.540741 17.540741l367.122963 0L547.460741 668.444444c-3.887407 3.887407-1.896296 12.325926 4.456296 18.773333 6.447407 6.447407 14.791111 8.438519 18.773333 4.456296l158.625185-158.625185c1.232593-1.232593 1.896296-2.844444 1.991111-4.740741 0.094815-1.706667 0.094815-3.318519 0-5.025185C731.117037 521.481481 730.453333 519.86963 729.220741 518.637037z" p-id="2446" fill="#515151">	
					</path></svg>
			</div>
			<div class="mui-button-row" style="border: 0rem; margin-top: 15px;">
				<a style="color: #000000;" id="register" onclick="register()">没有账号？我要注册</a>
			</div>
		</form>
		<script src="js/mui.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(
				// document.getElementById('primary').addEventListener('tap', function (){
				// 	plus.webview.open("index.html")
				// })
			)
			function login(){
				var Account = document.getElementById("account").value
				var Password = document.getElementById("password").value
				mui.ajax('http://localhost:8080/login',{
					data:{
						account: Account,
						password: Password
					},
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},
					success:function(data){
						if (data == true){
							alert("登录成功!")
							mui.openWindow({
							  url:'./index.html',					
							  id:'index.html'			
							  });
						}
						else{
							alert("用户名或密码错误，请重新输入")
						}
					},
					error:function(xhr,type,errorThrown){
						alert("登录失败！请重新登录")
					}
				});
			}
			function register(){
				mui.openWindow({
				  url:'./register.html',					
				  id:'register.html'			
				  });
			}
		</script>
	</body>
</html>
